@use 'config.scss'as config;

//
// inline-block
//
// @param $alignment 值为vertical-align的值
//
@mixin inline-block($alignment: config.$inline-block-alignment) {
  display: inline-block;

  @if $alignment and $alignment !=none {
    vertical-align: $alignment;
  }

  @if config.$legacy-support-for-ie {
    *vertical-align: auto;
    zoom: 1;
    *display: inline;
  }
}

//
// 清除浮动
//
@mixin clearfix {
  @if config.$legacy-support-for-ie {
    *zoom: 1;
  }

  &:before,
  &:after {
    content: "";
    display: table;
  }

  &:after {
    clear: both;
    overflow: hidden;
  }
}

%clearfix {
  @include clearfix;
}

//
// 文字溢出显示...
//
// @param $substract 百分比%
//
@mixin ellipsis($substract:0) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100% - $substract;
}

%ellipsis {
  @include ellipsis;
}

//
// opacity透明度
//
// @param $opacity 0-100的值
//
@mixin opacity($opacity:50) {
  opacity: $opacity / 100;

  @if config.$legacy-support-for-ie {
    filter: alpha(opacity=$opacity);
  }
}

//
// 禁用样式
//
// @param $textColor 文本颜色值
// @param $bgColor 背景颜色值
//
@mixin disabled($textColor:#ababab, $bgColor: none) {
  color: $textColor !important;
  cursor: not-allowed !important;

  @if $bgColor {
    background-color: $bgColor !important;
  }
}

//
// 最小高度
//
// @param $height 高度
//
@mixin min-height($height) {
  min-height: $height;
  height: auto !important;

  @if config.$legacy-support-for-ie {
    _height: $height;
  }
}
